import 'package:flutter/cupertino.dart';
import 'package:hitutor/UI/Member/MyOrder/MyOrderList.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'MyColor.dart';

class Global {
  static final APN = 1;
  static final Firebase = 2;
  static final JPush = 3;

  static List<dynamic> domains = [];

  static String token = "";
  static String studentId = "";
  static String userId = "";
  static String userName = "";

  static String regTip = "";

  static String shareLink = "";

  // static UserData userData = UserData();
  static String firebasetoken = "";
  static String JPushRegToken = "";
  static String APNSToken = "";
  static String deviceName = "";
  static String systemVersion = "";


  static String downloadPath = "";
  static List<dynamic> commentWords = [];

  static GlobalKey<MyOrderListState> myOrderKey = GlobalKey<MyOrderListState>();

  static saveUserInfo(String token, dynamic studentId, dynamic userId, String userName, Function callback) async {
    Global.token = "Bearer " + token;
    Global.studentId = studentId.toString();
    Global.userId = userId.toString();
    Global.userName = userName;
    SharedPreferences prefs = await SharedPreferences.getInstance();
    prefs.setString("token", Global.token);
    prefs.setString("studentId", studentId.toString());
    prefs.setString("userId", userId.toString());
    prefs.setString("userName", userName);
    callback();
  }

  static getShadow(Color color) {
    return BoxShadow(
        color: color,
        offset: Offset(0.0, 5.0), //阴影xy轴偏移量
        blurRadius: 10.0, //阴影模糊程度
        spreadRadius: 1.0 //阴影扩散程度
        );
  }

  static getBg(Color color, double radius) {
    return BoxDecoration(color: color, borderRadius: BorderRadius.circular(radius));
  }

  static getBorderBg(Color color, double radius) {
    return BoxDecoration(border: Border.all(width: 1, color: color), borderRadius: BorderRadius.circular(radius));
  }

  static getWhiteBg(double radius) {
    return BoxDecoration(color: MyColor.White, borderRadius: BorderRadius.circular(radius));
  }

  static getWhiteBg_shadow(double radius, Color color) {
    return BoxDecoration(boxShadow: [getShadow(color)], color: MyColor.White, borderRadius: BorderRadius.circular(radius));
  }

  static getBg_shadow(double radius, Color shadowColor, Color bgColor) {
    return BoxDecoration(boxShadow: [getShadow(shadowColor)], color: bgColor, borderRadius: BorderRadius.circular(radius));
  }

  static const List<String> wordPics = [
    "https://img2.baidu.com/it/u=883862496,1744092680&fm=26&fmt=auto",
    "http://imgx.xiawu.com/xzimg/i2/2920295161/TB2AMEkg2DH8KJjy1XcXXcpdXXa_!!2920295161.jpg",
    "https://c-ssl.duitang.com/uploads/blog/201505/20/20150520173610_Jf5y8.thumb.1000_0.jpeg"
  ];

  static const String videoUrl = "http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4";

  static const String audioUrl = "http://music.163.com/song/media/outer/url?id=1827600686.mp3";
  static const String winterUrl = "http://175.9.131.5:20002/winter.mp3";

  static const String netImage = "http://n.sinaimg.cn/tech/5_img/upload/e5308a4d/108/w1024h684/20210223/6449-kkmphps3300335.jpg";
  static const String winterImage = "http://bpic.588ku.com/element_origin_min_pic/18/06/10/89e88973e5c76c6ebfd810a4d61f7cce.jpg";

  static const String netQrImage =
      "https://qr.api.cli.im/newqr/create?data=sssssssss&level=H&transparent=false&bgcolor=%23FFFFFF&forecolor=%23000000&blockpixel=12&marginblock=1&logourl=&logoshape=no&size=260&kid=cliim&key=d8fe3b151a9067dc9034d63da6ff3c44";
}
